<html>
<head><meta charset="utf-8"><title>Allows in generated code · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Allows.20in.20generated.20code.html">Allows in generated code</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246552338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Allows%20in%20generated%20code/near/246552338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Wright <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Allows.20in.20generated.20code.html#246552338">(Jul 20 2021 at 07:15)</a>:</h4>
<p>Many crates that generate code include allows for Clippy lints. For example <a href="https://github.com/rustwasm/wasm-bindgen/blob/bf39cfd8bc7e6189425042c864d0079fc1b9c8b4/crates/backend/src/codegen.rs#L121">wasmbindgen</a> or <a href="https://github.com/TeXitoi/structopt/pull/337/files">structop</a>. Is this a good or bad thing to do? </p>
<p>If it's OK, then what is the correct way of doing it? Allowing <code>clippy::all</code> misses lints that are off by default. Listing each group will miss new groups that are added.</p>



<a name="246555127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Allows%20in%20generated%20code/near/246555127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Allows.20in.20generated.20code.html#246555127">(Jul 20 2021 at 07:54)</a>:</h4>
<p>We usually don't add groups. The <code>suspicious</code> group was the first group added since the Clippy 1.0 RFC 3 years ago. So allowing all groups should not create too much churn.  Also the group we added would've been covered by <code>clippy::all</code> So if you really want to allow <strong>all</strong> Clippy lints, this should do it:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![allow(clippy::all, clippy::pedantic, clippy::restriction, clippy::nursery)]</span><span class="w"></span>
</code></pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>